package com.zj.docker.component;

import com.spotify.docker.client.DefaultDockerClient;
import com.spotify.docker.client.DockerClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.net.URI;

/**
 * @Auther: zj
 * @Date: 2018/12/3 16:56
 * @Description: docker client(连接docker)
 */
@Component
public class DockerComponent {

    @Value("${docker.Url}")
    private String dockerUrl; //docker的ip地址+端口号

    public DockerClient getThisDockerClient() {
        DockerClient docker = DefaultDockerClient.builder()
                .uri( URI.create(dockerUrl) ) //2375端口，是centos7打开的远程访问端口，自己可自行设计
                // Set various options
                .build();

        return docker;
    }



}
